#include "ServerUser.h"

using namespace Network;

ServerUser::ServerUser()
: connection(0), id(0)
{
}

void ServerUser::attachToConnection(CL_NetGameConnection *connection)
{
	this->connection = connection;

	if(connection)
		connection->set_data("serveruser", this);
}

ServerUser *ServerUser::getUser(CL_NetGameConnection *connection)
{
	if(connection)
		return reinterpret_cast<ServerUser*>(connection->get_data("serveruser"));
	else
		return 0;
}

void ServerUser::sendEvent(const CL_NetGameEvent &gameEvent)
{
	if(connection)
		connection->send_event(gameEvent);
}
